package com.qidian.mes.pro.controller;

import com.qidian.mes.pojo.ProRoute;
import com.qidian.mes.pojo.WorkTicket;
import com.qidian.mes.pro.service.RouteService;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Author chenzheng
 * @Company 起点编程
 * @Time 2023/10/28 9:21
 * @Description
 */
@RestController
@RequestMapping("/route")
@CrossOrigin
public class RouteController {
    @Autowired
    private RouteService routeService;
    //路线查询
    @GetMapping("/get")
    public MESResult get(Long routeId){
        return routeService.queryById(routeId);
    }
    //新增路线
    @PostMapping("/save")
    public MESResult save(@RequestBody ProRoute proRoute){
        return routeService.save(proRoute);
    }
    //编辑路线
    @PutMapping("/update")
    public MESResult update(@RequestBody ProRoute proRoute){
        return routeService.update(proRoute);
    }
    //删除路线
    @DeleteMapping("/delete")
    public MESResult delete(Long routeId){
        return routeService.delete(routeId);
    }
    @GetMapping("/list")
    public MESResult list(@RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10") int limit, ProRoute proRoute){
        return routeService.list(page,limit,proRoute);
    }
}
